Unicsv: whack dead code.
authorrobertl <robertl>
Fri, 14 Jul 2006 21:22:23 +0000 (21:22 +0000)
committerrobertl <robertl>
Fri, 14 Jul 2006 21:22:23 +0000 (21:22 +0000)
util.c: vaporize pointless pointer deref.
holux.c: make date handling less wrong.  (I think.)

holux.c
unicsv.c
util.c

diff --git a/holux.c b/holux.c
index c63a02bd19ee700c26f20e017920fd3ce769b659..df475d6c95d13c447d819c677126b74625299301 100644 (file)
--- a/holux.c
+++ b/holux.c
@@ -125,15 +125,25 @@ static void data_read(void)
                wpt_tmp->creation_time = 0;
         if (pWptHxTmp->date.year)
         {
+#if 0
+       /* Unless there's some endian swapping that I don't see,
+        * this can't be right.  Then again, the definition of the
+        * the structure itself has a pretty serious disregard for
+        * host word size issues... - rjl
+        */
             ptm = gmtime((time_t*)&pWptHxTmp->time);
-                   tm.tm_hour = ptm->tm_hour; 
-            tm.tm_min = ptm->tm_min;
-                   tm.tm_sec = ptm->tm_sec;
-
-            tm.tm_mday = pWptHxTmp->date.day;
-                   tm.tm_mon = pWptHxTmp->date.month - 1;
-                   tm.tm_year = pWptHxTmp->date.year - 1900;
-            wpt_tmp->creation_time = mktime(&tm); 
+#else
+               time_t wt = le_read32(&pWptHxTmp->time);
+               ptm = gmtime(&wt);
+#endif
+               tm.tm_hour = ptm->tm_hour; 
+               tm.tm_min = ptm->tm_min;
+               tm.tm_sec = ptm->tm_sec;
+
+               tm.tm_mday = pWptHxTmp->date.day;
+               tm.tm_mon = pWptHxTmp->date.month - 1;
+               tm.tm_year = pWptHxTmp->date.year - 1900;
+               wpt_tmp->creation_time = mktime(&tm); 
         }
 
         lon = le_read32(&pWptHxTmp->pt.iLongitude) / 36000.0; 
index a5de55a4d33935177bf4dda80ccb1217408abaa9..be72b2b73a6679773b22a56bc5b2952d73385f2b 100644 (file)
--- a/unicsv.c
+++ b/unicsv.c
@@ -54,20 +54,6 @@ arglist_t unicsv_args[] = {
 
 /* helpers */
 
-/* fread_buff: returns only left and right trimmed non-empty lines or NULL */
-static char *
-fread_buff(textfile_t *tin)
-{
-       char *result;
-       
-       while ((result = textfile_read(tin)))
-       {
-               result = lrtrim(result);
-               if (*result != '\0') break;
-       }
-       return result;
-}
-
 #define UNICSV_IS(f) (0 == strcmp(s, f))
 #define UNICSV_CONTAINS(f) (0 != strstr(s, f))
 
diff --git a/util.c b/util.c
index 895dcfabcf471b4baab1d1ba2b060dbe70bf97ee..b61a12cc06f06a4ebeed4e860bb7726777638131 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1240,7 +1240,7 @@ strip_html(const utf_string *in)
                        
                      tag[0] = 0;
                }
-               *instr++;
+               instr++;
        }
        *out++ = 0;
        return (outstring);